package user;

import operations.*;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: AliceMana
 * Date: 2022-08-11
 * Time: 15:21
 */
public class AdminUser extends User {

    public AdminUser(String userName) {
        super(userName);
        this.iOperations = new IOperation[] {
                new Exit(),
                new Find(),
                new Add(),
                new Del(),
                new Display()
        };
    }

    @Override
    public int menu() {
        System.out.println("hello "+ getUserName() + " 欢迎来到图书小练习! ");
        System.out.println("1. 查找图书");
        System.out.println("2. 新增图书");
        System.out.println("3. 删除图书");
        System.out.println("4. 显示图书");
        System.out.println("0. 退出系统");
        while (true) {
            System.out.println("请输入你的操作：");
            Scanner in = new Scanner(System.in);
            int choice = in.nextInt();
            if (choice < 0 || choice > 4) {
                System.out.println("输入错误请重新输入！");
            } else {
                return choice;
            }
        }
    }
}
